package me.zhengjie.service.impl;

import cn.hutool.core.util.IdUtil;
import lombok.RequiredArgsConstructor;
import me.zhengjie.domain.ErpChunk;
import me.zhengjie.domain.ErpFiles;
import me.zhengjie.repository.FzChunkRepository;
import me.zhengjie.repository.FzFilesRepository;
import me.zhengjie.service.FzFilesService;
import me.zhengjie.utils.SecurityUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.io.*;
import java.util.ArrayList;
import java.util.List;

@Service
@RequiredArgsConstructor
public class FzFilesServiceImpl implements FzFilesService {

    private final FzFilesRepository fzFilesRepository;

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void save(ErpFiles files) {
        fzFilesRepository.save(files);
    }

    @Override
    public List<ErpFiles> findByMd5(String md5) {
        return fzFilesRepository.findByMd5(md5);
    }

    @Override
    public List<ErpFiles> findByBid(String bid) {
        return fzFilesRepository.findBybid(bid);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public int deleteByBid(String bid) {
        return fzFilesRepository.deleteByBid(bid);
    }
}
